---
layout: m1x_soap
title: Invoice Capture
---

<h2><a name="sales_order_invoice.capture-Module%3AMageSales"></a>Module: Mage_Sales</h2>


<h4><a name="sales_order_invoice.capture-Resource%3Asalesorderinvoice"></a>Resource: sales_order_invoice</h4>

<p><b>Aliases</b>:</p>
<ul>
	<li>order_invoice</li>
</ul>


<h5><a name="sales_order_invoice.capture-Method%3A"></a>Method:</h5>

<ul>
	<li>sales_order_invoice.capture (SOAP V1)</li>
	<li>salesOrderInvoiceCapture (SOAP V2)</li>
</ul>


<p>Allows you to capture the required invoice. Note that not all order invoices can be captured. Only some payment methods support capturing the order invoice (e.g., PayPal Pro).</p>

<p><b>Aliases</b>:</p>
<ul>
	<li>order_invoice.capture</li>
</ul>



<p><b>Arguments</b>:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> sessionId </td>
<td> Session ID </td>
</tr>
<tr>
<td> string </td>
<td> invoiceIncrementId <br class="atl-forced-newline" /> </td>
<td> Invoice increment ID </td>
</tr>
</tbody></table>


<p><b>Returns</b>:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Description </th>
</tr>
<tr>
<td> boolean\int </td>
<td> True (1) if the order invoice is captured. </td>
</tr>
</tbody></table>



<p><b>Notes</b>:</p>

<p>You should check the invoice to see if it can be captured before attempting to capture the invoice. Otherwise, the API call will generate an error.</p>

<p>Invoices have states as defined in the model Mage_Sales_Model_Order_Invoice:</p>
<ul>
	<li>STATE_OPEN = 1</li>
	<li>STATE_PAID = 2</li>
	<li>STATE_CANCELED = 3</li>
</ul>


<p>Also note that there is a method call in the model that checks this for you - canCapture(). And it also verifies that the payment can be captured, so the invoice state might not be the only condition that is required to allow it to be captured.</p>

<h4><a name="sales_order_invoice.capture-Examples"></a>Examples</h4>

<h5><a name="sales_order_invoice.capture-RequestExampleSOAPV1"></a>Request Example SOAP V1</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div>
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy-&gt;login('apiUser', 'apiKey');

$orderIncrementId = '100000016';

//Create invoice for order
$invoiceIncrementId = $proxy-&gt;call(
    $session,
    'sales_order_invoice.create',
    array(
        'orderIncrementId' =&gt; $orderIncrementId,
        array('order_item_id' =&gt; '15', 'qty' =&gt; '1')
    )
);

//Capture invoice amount
$result = $proxy-&gt;call(
    $session,
    'sales_order_invoice.capture',
    $invoiceIncrementId
);</pre>
		</div>
</div></div>

<h5><a name="sales_order_invoice.capture-RequestExampleSOAPV2"></a>Request Example SOAP V2</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div>
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
$sessionID = $proxy-&gt;login('apiUser', 'apiKey');

$orderIncrementId = '100000016';

//Create invoice for order
$qty = array(
    array('order_item_id' =&gt; '15', 'qty' =&gt; '1')
);
$invoiceIncrementId = $proxy-&gt;salesOrderInvoiceCreate(
     $sessionID,
     $orderIncrementId,
     $qty);

//Capture invoice amount
$result = $proxy-&gt;salesOrderInvoiceCapture(
     $sessionID,
     $invoiceIncrementId
);</pre>
		</div>
</div></div>


<h5><a name="sales_order_invoice.capture-RequestExampleSOAPV2%28WSIComplianceMode%29"></a>Request Example SOAP V2 (WS-I Compliance Mode)</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div>
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); 

$sessionId = $proxy-&gt;login((object)array('username' =&gt; 'apiUser', 'apiKey' =&gt; 'apiKey')); 
 
$result = $proxy-&gt;salesOrderInvoiceCapture((object)array('sessionId' =&gt; $sessionId-&gt;result, 'invoiceIncrementId' =&gt; '100000016'));   

var_dump($result-&gt;result);</pre>
		</div>
</div></div>



